package farmer.update.building;

import farmer.core.BuildingRessource;

public abstract class Mine extends BuildingRessource{
	
	public static int woodCostS = 60;
	public static int rockCostS = 10;
	
	private int maxRessource = 20;
	
	private final int timeToMine = 5*1000;
	private int timeUntilNextMine = timeToMine;

	public Mine(int x, int y) {
		super(x, y);
		size = 3;
		woodCost = 60;
		rockCost = 10;
	}
	
	@Override
	public void update(int deltaTime){
		if(timeUntilNextMine > 0){
			timeUntilNextMine -= deltaTime;
			if(timeUntilNextMine <= 0){;
				ressource++;
				if(ressource == maxRessource){
					timeUntilNextMine = 0;
				}else{
					timeUntilNextMine = timeToMine;
				}
			}
		}
	}

}
